Skip to content

fix(ipc-runtime): give iPads and desktop-mode iPhones the iOS wasm memory maximum - #25760

Merged
just-mitch merged 3 commits into
nextfrom
mitch/zkm-1779-bbjs-gives-ipads-and-desktop-mode-iphones-the-desktop-memory
Nov 5, 2026
Merged

just-mitch merged 3 commits into
nextfrom
mitch/zkm-1779-bbjs-gives-ipads-and-desktop-mode-iphones-the-desktop-memory

Conversation

@just-mitch

@just-mitch just-mitch commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Before this PR, an iPad and an iPhone with Request Desktop Website on got the desktop wasm memory maximum of 4 GiB, because they send a Mac user agent. On an iPad, the zk.money PXE failed with "RangeError: Out of memory".

After this PR, these devices get the iOS maximum of 1 GiB (2 ** 14 pages) when the page creates the backend.

The thread that creates the backend resolves the memory maximum

A worker has no navigator.maxTouchPoints, so the main worker cannot detect these devices. WasmFfiBackend.create resolves the maximum and sends it in the init message. A maximum that the caller sets still has priority. Evidence: the Pointer Events WebIDL declares maxTouchPoints on Navigator only.

isIos in @aztec-foundation/ipc-runtime/wasm

It matches iPad or iPhone, or a Macintosh user agent with maxTouchPoints > 1. It is not in the package root, which imports node:net and node:child_process.

Other changes

  • The iOS and desktop values stay the same.
  • WasmPlatform.maximumMemoryPages documents the thread that reads it.

Known issues

  • A backend that a Web Worker creates still gets the desktop maximum. The wallet sets the values explicitly in ZKM-1780.

Ticket: ZKM-1779. Child PRs: #25761, #25763.

@just-mitch
just-mitch added this pull request to stack #25762 November 4, 2026 18:36
@just-mitch just-mitch changed the title mitch/zkm 1779 bbjs gives ipads and desktop mode iphones the desktop memory fix(ipc-runtime): give iPads and desktop-mode iPhones the iOS wasm memory maximum Nov 4, 2026
@just-mitch
just-mitch marked this pull request as ready for review November 5, 2026 01:17
const { userAgent, maxTouchPoints } = navigator;
return (
/iPad|iPhone/.test(userAgent) ||
(/Macintosh/.test(userAgent) && maxTouchPoints > 1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check will identify the new MacBooks with touchscreens as iPads. Just pointing out in case we needed the extra memory on MacBooks.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm yeah good point. We'll have to see when they're released if/how we need to tweak this.

@iakovenkos

Copy link
Copy Markdown
Contributor

@just-mitch please, rebase to next and merge directly

@just-mitch
just-mitch removed this pull request from stack #25762 November 5, 2026 16:52
…S settings

iPadOS Safari and an iPhone that requests the desktop website send a Mac
user agent. The iOS check matched only "iPad" or "iPhone", so these devices
got the 4 GiB wasm memory maximum and the 2**19 SRS, and proofs failed with
"RangeError: Out of memory".

- isIos, exported from @aztec-foundation/ipc-runtime/wasm, also matches a
  Mac user agent with navigator.maxTouchPoints > 1. The browser memory
  maximum and the bb.js default SRS size use it.
- The thread that creates the async wasm backend resolves the memory
  maximum and sends it to the main worker, because a worker has no
  maxTouchPoints.

ZKM-1779
…its tests

The bb.js SRS size change goes to the layer above (ZKM-1782), so that each
layer stays in the review budget. The memory tests keep the same cases in
one table.

ZKM-1779
…ds the memory maximum

A worker's navigator has no maxTouchPoints, so in a worker an iPad reads as a Mac.

ZKM-1779
@just-mitch
just-mitch force-pushed the mitch/zkm-1779-bbjs-gives-ipads-and-desktop-mode-iphones-the-desktop-memory branch from 3c6199a to ecdb999 Compare November 5, 2026 16:53
@just-mitch
just-mitch changed the base branch from merge-train/barretenberg to next November 5, 2026 16:53
@just-mitch
just-mitch added this pull request to stack #25766 November 5, 2026 16:53
@just-mitch
just-mitch merged commit 69a51a8 into next Nov 5, 2026
21 of 23 checks passed
@just-mitch
just-mitch deleted the mitch/zkm-1779-bbjs-gives-ipads-and-desktop-mode-iphones-the-desktop-memory branch November 5, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants